package sany.iec.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @Author 托马斯
 * @Date 2025/7/5 21:17
 * @Description DataCategoryEnum
 */
@AllArgsConstructor
@Getter
public enum DataCategoryEnum {

    YK("yk", "遥控"),

    YX("yx", "遥信"),

    YT("yt", "遥调"),

    YC("yc", "遥测")

    ;

    private final String category;

    private final String description;

    public static DataCategoryEnum getDataCategoryEnum(String category) {
        if (StringUtils.isBlank(category)) {
            return null;
        }
        for (DataCategoryEnum dataCategoryEnum : DataCategoryEnum.values()) {
            if (category.toLowerCase().contains(dataCategoryEnum.getCategory().toLowerCase())) {
                return dataCategoryEnum;
            }
        }
        return null;
    }

}
